<?php
class Zwei_DB_Table_Row extends Zend_Db_Table_Row_Abstract
{
    // Return modifiedFields
    public function getModifiedFields()
    {
        return $this->_modifiedFields;
    }
 
    // Return a hash of only modified field => value pairs
    public function getModifiedValues()
    {
        $modifiedValues = array();
        foreach ($this->_modifiedFields as $field => $value)
        {
            $modifiedValues[$field] = $this->_data[$field];
        }
        return $modifiedValues;
    }
 
    //Override, don't allow unmodified fields to be marked...
    public function __set($columnName, $value)
    {
        $columnName = $this->_transformColumn($columnName);
        if (!array_key_exists($columnName, $this->_data)) {
            throw new Zend_Db_Table_Row_Exception(
                "Specified column \"$columnName\" is not in the row"
            );
        }
 
        $origData = $this->_data[$columnName];
        if ($origData != $value) {
            $this->_data[$columnName] = $value;
            $this->_modifiedFields[$columnName] = true;
        }
 
    }

}
